{include file="public/com_header"}

<body style="padding:10px;">
    <div class="tplay-body-div">
        <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
        <!--<form id="downloadImageForm" class="layui-form serch" action="{:url('admin/Tools/downloadImage')}" method="post">-->
        <form id="downloadImageForm" class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label"> 图片Url </label>
                <div class="layui-input-inline">
                  <input type="text" name="url" lay-verify="title" autocomplete="off" placeholder="请输入Url" class="layui-input" style="width: 500px;">
                </div>
                <!--<button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="ImageUrl">立即提交</button>-->
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="ImageUrl">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
                </div>
            </div>
        </form>
        </fieldset>




        <script>
            layui.use(['layer', 'form'], function() {
                var layer = layui.layer,
                    $ = layui.jquery,
                    form = layui.form;
                $(window).on('load', function() {
                    form.on('submit(ImageUrl)', function(data) {
                        $.ajax({
                            url:"{:url('admin/Tools/downloadImage')}",
                            data:$('#downloadImageForm').serialize(),
                            type:'post',
                            async: false,
                            success:function(res) {
                                if(res.code == 1) {
                                    layer.alert(res.msg)
                                } else {
                                layer.msg(res.msg);
                                }
                            }
                        })
                        return false;
                    });
                });
            });
        </script>

    </div>
</body>
</html>
